'\" te
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH GETZONEROOTBYID 3TSOL "Jul 20, 2007"
.SH NAME
getzonerootbyid, getzonerootbylabel, getzonerootbyname \- map between zone root
pathnames and labels
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [\fIflags\fR...] \fIfile\fR... \fB-ltsol\fR [\fIlibrary\fR...]
.fi

.LP
.nf
#include <tsol/label.h>

\fBchar *\fR\fBgetzonerootbyid\fR(\fBzoneid_t\fR \fIzoneid\fR);
.fi

.LP
.nf
\fBchar *\fR\fBgetzonerootbylabel\fR(\fBconst m_label_t *\fR\fIlabel\fR);
.fi

.LP
.nf
\fBchar *\fR\fBgetzonerootbyname\fR(\fBconst char *\fR\fIzonename\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBgetzonerootbyid()\fR function returns the root pathname of \fIzoneid\fR.
.sp
.LP
The \fBgetzonerootbylabel()\fR function returns the root pathname of the zone
whose label is \fIlabel\fR.
.sp
.LP
The \fBgetzonerootbyname()\fR function returns the root pathname of
\fIzonename\fR.
.sp
.LP
All of these functions require that the specified zone's state is at least
\fBZONE_IS_READY\fR. The zone of the calling process must dominate the
specified zone's label, or the calling process must be in the global zone. The
returned pathname is relative to the root path of the caller's zone.
.SH RETURN VALUES
.sp
.LP
On successful completion, the \fBgetzonerootbyid()\fR,
\fBgetzonerootbylabel()\fR, and \fBgetzonerootbyname()\fR functions return a
pointer to a pathname that is allocated within these functions. To free the
storage, use \fBfree\fR(3C). On failure, these functions return \fBNULL\fR and
set \fIerrno\fR to indicate the error.
.SH ERRORS
.sp
.LP
These functions will fail if:
.sp
.ne 2
.na
\fB\fBEFAULT\fR\fR
.ad
.RS 10n
Invalid argument; pointer location is invalid.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
\fIzoneid\fR invalid, or zone not found or not ready.
.RE

.sp
.ne 2
.na
\fB\fBENOENT\fR\fR
.ad
.RS 10n
Zone does not exist.
.RE

.sp
.ne 2
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 10n
Unable to allocate pathname.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
_
MT-Level	Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR Intro (2),
.BR free (3C),
.BR getzonenamebyid (3C),
.BR libtsol (3LIB),
.BR attributes (7),
.BR labels (7)
.SH NOTES
.sp
.LP
The functionality described on this manual page is available only if the system
is configured with Trusted Extensions.
